// import 'package:cherrilog/cherrilog.dart';
import 'package:city_pickers/city_pickers.dart';
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:shake_animation_widget/shake_animation_widget.dart';
import 'package:study_demo/base/BaseController.dart';
import 'package:study_demo/ui/game/game_hall_page.dart';
import 'package:study_demo/ui/main/pages/widgets_example_page.dart';
import 'package:study_demo/ui/setting/setting_page.dart';

import '../app_release/app_release_page.dart';
import '../note/note_hall_page.dart';
import '../problem/problem_page.dart';
import '../tool/tool_page.dart';
import 'pages/anim_page.dart';
import 'pages/widgets_page.dart';

class MainController extends BaseController {
  final layoutType = 0.obs;

  /// 抖动动画控制器
  ShakeAnimationController shakeAnimationController =
      ShakeAnimationController();

  Result resultArr = new Result();

  List<IconData> icons = [
    Icons.home,
    Icons.gif_box,
    Icons.widgets,
    Icons.store,
    Icons.app_registration_rounded,
    Icons.edit_note_sharp,
    Icons.report_problem_outlined,
    Icons.games,
    Icons.animation,
    Icons.settings,
  ];

  List<String> data = [
    '主页',
    '工具',
    '组件',
    '例子',
    "应用发布",
    '笔记',
    '问题',
    "游戏",
    '动画',
    '设置',
  ];

  List<Widget> widgets = [
    ToolPage(),
    WidgetsPage(),
    WidgetsExamplePage(),
    AppReleasePage(),
    NoteHallPage(),
    ProblemPage(),
    GameHallPage(),
    AnimPage(),
    SettingPage()
  ];

  changeLayout(int type) {
    layoutType.value = type;
    print('layoutType${layoutType}');
  }

  @override
  void onInit() {
    super.onInit();
    // debug('You are doing something right');
    // info('You are doing something');
    // warning('You are doing something wrong');
    // error('You can not shutdown power');
    // fatal('The power is off');
    request();
  }

  request() async {
    String url = 'https://www.19x19.com/api/engine/golives/159540';
    var response = await Dio(
            BaseOptions(connectTimeout: Duration(milliseconds: 15 * 1000)))
        .get(url);
    print('data:${response.data}');
  }
}
